using System.Collections;

namespace MFWebSockets.Core.Utilities.Collections.NameValue
{
    public class NameValueEnumerator : IEnumerator
    {
         NameValueCollection _collection;
         int _idx = -1;

        public NameValueEnumerator(NameValueCollection collection)
        {
            _collection = collection;
        }

        #region IEnumerator Members

        public object Current
        {
            get
            {
                return _collection[_idx];
            }
        }

        public bool MoveNext()
        {
            _idx++;
            if (_idx < _collection.Count)
            {
                return true;
            }
            else
            {
                _idx = -1;
                return false;
            }

        }

        public void Reset()
        {
            _idx = -1;
        }

        #endregion
    }
}
